package 华为机试;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class 华为机试第二题 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            String s = sc.nextLine();
            System.out.println(func(s));
        }
        sc.close();
    }

    private static String func(String s) {
        if (!isRight(s))
            return "!error";

        //分离并处理
        String zipreg = "[0-9]+[a-z]{1}";
        String[] unzip = s.split(zipreg);
        ArrayList<String> zipList = new ArrayList<>();
        Matcher m = Pattern.compile(zipreg).matcher(s);
        StringBuilder sb = new StringBuilder();
        while (m.find()) {
            String str = m.group();
            int n = Integer.parseInt(str.substring(0, str.length() - 1));
            for (int i = 0; i < n; i++)
                sb.append(str.charAt(str.length() - 1));
            zipList.add(sb.toString());
            sb.delete(0, sb.length());
        }

        //调试,可以删除
        System.out.println(Arrays.toString(unzip));
        System.out.println(zipList.toString());

        //归并
        StringBuilder res = new StringBuilder();
        int i = 0, j = 0;
        while (true) {
            if (i == unzip.length || j == zipList.size())
                break;
            if (i < unzip.length)
                res.append(unzip[i++]);
            if (j < zipList.size())
                res.append(zipList.get(j++));
        }
        while (i < unzip.length)
            res.append(unzip[i++]);
        while (j < zipList.size())
            res.append(zipList.get(j++));
        return res.toString();
    }

    private static boolean isRight(String s) {
        //数字和字母组成
        if (s.replaceAll("[0-9a-z]+", "").length() != 0)
            return false;
        //3个连续字母组成
        String re_01 = "[a]{3,}|[b]{3,}|[c]{3,}|[d]{3,}|[e]{3,}|[f]{3,}|[g]{3,}|[h]{3,}|[i]{3,}|[j]{3,}|[k]{3,}|[l]{3,}|[m]{3,}|[n]{3,}|[o]{3,}|[p]{3,}|[q]{3,}|[r]{3,}|[s]{3,}|[t]{3,}|[u]{3,}|[v]{3,}|[w]{3,}|[x]{3,}|[y]{3,}|[z]{3,}";
        if (s.replaceAll(re_01, "").length() != s.length())
            return false;
        //2或以上个字母连续且前面有数字的
        String re_02 = "[0-9]+[a]{2,}|[0-9]+[b]{2,}|[0-9]+[c]{2,}|[0-9]+[d]{2,}|[0-9]+[e]{2,}|[0-9]+[f]{2,}|[0-9]+[g]{2,}|[0-9]+[h]{2,}|[0-9]+[i]{2,}|[0-9]+[j]{2,}|[0-9]+[k]{2,}|[0-9]+[l]{2,}|[0-9]+[m]{2,}|[0-9]+[n]{2,}|[0-9]+[o]{2,}|[0-9]+[p]{2,}|[0-9]+[q]{2,}|[0-9]+[r]{2,}|[0-9]+[s]{2,}|[0-9]+[t]{2,}|[0-9]+[u]{2,}|[0-9]+[v]{2,}|[0-9]+[w]{2,}|[0-9]+[x]{2,}|[0-9]+[y]{2,}|[0-9]+[z]{2,}";
        if (s.replaceAll(re_02, "").length() != s.length())
            return false;
        //末尾数字
        String re_03 = "[0-9]+$";
        if (s.replaceAll(re_03, "").length() != s.length())
            return false;

        //有1a,2b
        Matcher m = Pattern.compile("[0-9]+").matcher(s);
        while (m.find()) {
            int n = Integer.parseInt(m.group());
            if (n <= 2)
                return false;
        }

        return true;
    }
}

